package com.doxiaopu.students.product.service.impl;

import com.doxiaopu.students.product.mapper.MyTaskVOMapper;
import com.doxiaopu.students.product.service.IMyTaskVOService;
import com.doxiaopu.students.product.vo.MyTaskVO;
import com.doxiaopu.students.user.entity.User;
import com.doxiaopu.students.user.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Primary
public class MyTaskVOServiceImpl implements IMyTaskVOService {
    @Autowired
    private MyTaskVOMapper myTaskVOMapper;
    @Autowired
    private UserMapper userMapper;

    @Override
    public List<MyTaskVO> myTaskList(Integer id) {
        User user = userMapper.getById(id);
        String massOrganizationId =user.getMassOrganizationId();
        return getMyTaskList(massOrganizationId);
    }

    /**
     * 通过社团mass_organization_id查询认为有列表
     * @param massOrganizationId
     * @return
     */
    private List<MyTaskVO> getMyTaskList(String massOrganizationId){
        return myTaskVOMapper.getMyTaskList(massOrganizationId);
    };
}
